{extend name="adminblue/base" /}
{block name="resources"}
<style>
.table-logo{display:inline-block;width:75px;float:left;}
.table-pay{display:inline-block;width:590px;overflow:hidden;margin-top: 7px;}
.table-desc{display:inline-block;width:590px;overflow:hidden;}
</style>
{/block}
{block name="main"}
<table class="table-class">
	<colgroup>
		<col width="70%">
		<col width="15%">
		<col width="15%">
	</colgroup>
	<thead>
		<tr class="table-title" style="background: white;z-index: 10;border: 1px solid #E3E3E3;">
			<th class="tal">转账方式</th>
			<th style="text-align: center;">状态</th>
			<th style="text-align: center;">操作</th>
		</tr>
	</<thead>
	<tbody>
		{volist name="pay_list" id="pay_obj"}
		<tr>
			<td>
				<div class="table-logo"><img src="__ROOT__/{$pay_obj.logo}"/></div>
				<span class="table-pay">{$pay_obj.pay_name}</span>
				<span class="table-desc">{$pay_obj.desc}</span> 
			</td>
			{if condition="$pay_obj.is_open eq 1"}
			<td style="text-align: center;line-height:59px;"><a href="javascript:;" class="pay-start" status =1 onclick="set_status('{$pay_obj.key}', this)"><img src="ADMIN_IMG/checked.png" alt="" width="18"/></a></td>
			{else/}
			<td style="text-align: center;line-height:59px;"><a href="javascript:;" class="pay-close" status =0 onclick="set_status('{$pay_obj.key}', this)"><img src="ADMIN_IMG/un_checked.png" alt="" width="18"/></a></td>
			{/if}
			<td style="text-align: center;line-height:59px;">
			{if condition="$pay_obj.key eq 'TRANSFER_ACCOUNTS_SETTING_WECHAT'"}
				<a href="{:__URL('ADMIN_MAIN/config/transferAccountsSetting')}">配置</a>
			{else/}
				<a href="{:__URL('ADMIN_MAIN/config/transferAccountsSetting.html?type=alipay')}">配置</a>
			{/if}
			</td>
		</tr>
		{/volist}
	</tbody>
</table>
<script>
function set_status(type,event){
	var status = $(event).attr('status');
	if(status == 1){
		var change_status = 0;
	}
	else{
		var change_status = 1;
	}
	$.ajax({
		type : "post",
		url : "{:__URL('ADMIN_MAIN/config/setTransferStatus')}",
		data : {
			'is_use' : change_status,
			'type' : type
		},
		success : function(data) {
			if (data["code"] > 0) {
				if(status == 1){
					$(event).attr('status', 0);
					$(event).find('img').attr('src', 'ADMIN_IMG/un_checked.png');
				}else{
					$(event).attr('status', 1);
					$(event).find('img').attr('src', 'ADMIN_IMG/checked.png');
				}
				showMessage('success', data["message"]);
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}
</script>
{/block}